class InviteeListsController < ApplicationController
  def create
      @event = Event.find(params[:event_id])
      @inviteeList = @event.inviteeLists.create(params[:inviteeList])
      redirect_to event_path(@event)
  end
    
    # DELETE /users/1
    # DELETE /users/1.json
    def destroy

        @invitee = InviteeList.find(params[:id])
        @invitee.destroy  
        
        respond_to do |format|
            format.html { redirect_to users_url }
            format.json { head :no_content }
        end
    end    
    
    def edit
        @invitee = InviteeList.find(params[:id])
        if @invitee == nil
            redirect_to event_path
        end
        if request.post?
            @invitee.update_attributes(params[:inviteeList])
            if @invitee.save
                flash[:notice]="Attendence saved"
                redirect_to '/events/'+@invitee.event_id.to_s
                else
                flash[:warning]="Error saving profile"
            end
        end
    end
end
